package NGUYENTIENDAT.OOP.EX;

public class Controller {

	private UserEntity m_objUser;
	private Model m_objModel;

	// Ham khoi tao cho model
	public Controller(UserEntity objUser) {
		m_objUser = objUser;

		// Khoi tao thong tin cho Model
		m_objModel = new Model();
	}

	// Uy quyen thuc thi nghiep vu thong qua models
	public boolean CheckUser() {
		// Dieu huong thuc thi nghiep vu sau:
		// 1. Kiem tra su ton tai cua tai khoan

		if (m_objModel.CheckUser(m_objUser)) {
			if (m_objModel.CheckActive(m_objUser)) {
				if (m_objModel.CheckSoDuTK(m_objUser)) {
					if (m_objModel.CheckLock(m_objUser)) {
						return true;
					} else {
						return false;
					}
				} else {
					return false;
				}
			} else {
				return false;
			}
		} else {
			return false;
		}
	}
}
